
/**
 * this class save the data for the questions:
 * Max value, Min value, AVG value,   and calculate them
 */
public class QuestionData{
		int max;
		int min;
		double avg;
		int sum=0;
		int numberOfEx;
		
		/**
		 * 
		 * @return max value
		 */
		public int getMax() {
			return max;
		}
		
		/**
		 * 
		 * @param max- set the max value
		 */
		public void setMax(int max) {
			this.max = max;
		}
		
		/**
		 * 
		 * @return the min value
		 */
		public int getMin() {
			return min;
		}
		
		/**
		 * 
		 * @param min- set the min value
		 */
		public void setMin(int min) {
			this.min = min;
		}
		
		/**
		 * 
		 * @return the AVG value
		 */
		public double getAvg() {
			return avg;
		}
		
		/**
		 * 
		 * @param avg- set the AVG value
		 */
		public void setAvg(int avg) {
			this.avg = avg;
		}
		
		
		/**
		 * C'tor - initialize all the parameters
		 */
		QuestionData()
		{
			max=0;
			avg=0;
			sum=0;
			numberOfEx=0;
			
		}
		
		/**
		 * 
		 * @param numberCorrect- get a new number for data
		 * and add it to the avg value and also change the min and max values (if need)
		 */
		public void newNumber(int numberCorrect)
		{
			if(max<numberCorrect)
				max=numberCorrect;
			if (min>numberCorrect)
				min=numberCorrect;
			sum+=numberCorrect;
			numberOfEx++;
			avg =(double)sum/(double)numberOfEx; 
			
		}
		
	}